-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Collection change tracking for primitive collections #31480
Conversation
{ | ||
} | ||
|
||
private static bool Compare(IEnumerable<TElement>? a, IEnumerable<TElement>? b, ValueComparer<TElement> elementComparer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be compatible with compiled models these methods need to be public.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, they shouldn't use captured variables. Instead, in-line the element comparer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's leave this for RC2. I can see it fails with compiled models, but I can't see the path forward where we can get the element comparer without capturing it in some way. Will file an issue. We can discuss.
System.NotSupportedException
Encountered a constant of unsupported type '<>c__DisplayClass0_0'. Only primitive constant nodes are supported.
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.<VisitConstant>g__GenerateValue|36_0(Object value, <>c__DisplayClass36_0&) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 949
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.VisitConstant(ConstantExpression constant) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 878
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.Visit(Expression node) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 204
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.Translate[T](Expression node) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 158
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.VisitMember(MemberExpression member) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 1350
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.Visit(Expression node) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 204
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.Translate[T](Expression node) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 158
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.TranslateList(IReadOnlyList`1 list) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 2175
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.TranslateMethodArguments(ParameterInfo[] parameters, IReadOnlyList`1 arguments) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 2135
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.VisitMethodCall(MethodCallExpression call) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 1393
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.Visit(Expression node) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 204
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.Translate(Expression node) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 145
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.VisitLambda[T](Expression`1 lambda) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 1228
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.Visit(Expression node) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 204
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.TranslateCore(Expression node, ISet`1 collectedNamespaces, Boolean statementContext) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 117
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.TranslateExpression(Expression node, ISet`1 collectedNamespaces) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 101
at Microsoft.EntityFrameworkCore.Design.Internal.CSharpHelper.Expression(Expression node, ISet`1 collectedNamespaces) in C:\github\efcore\src\EFCore.Design\Design\Internal\CSharpHelper.cs:line 1545
at Microsoft.EntityFrameworkCore.Design.Internal.CSharpRuntimeAnnotationCodeGenerator.Create(ValueComparer comparer, CSharpRuntimeAnnotationCodeGeneratorParameters parameters, ICSharpHelper codeHelper) in C:\github\efcore\src\EFCore\Design\Internal\CSharpRuntimeAnnotationCodeGenerator.cs:line 394
at Microsoft.EntityFrameworkCore.Design.Internal.RelationalCSharpRuntimeAnnotationCodeGenerator.Create(CoreTypeMapping typeMapping, CSharpRuntimeAnnotationCodeGeneratorParameters parameters, ValueComparer valueComparer, ValueComparer keyValueComparer, ValueComparer providerValueComparer) in C:\github\efcore\src\EFCore.Relational\Design\Internal\RelationalCSharpRuntimeAnnotationCodeGenerator.cs:line 2128
at Microsoft.EntityFrameworkCore.Design.Internal.ICSharpRuntimeAnnotationCodeGenerator.Create(CoreTypeMapping typeMapping, IProperty property, CSharpRuntimeAnnotationCodeGeneratorParameters parameters) in C:\github\efcore\src\EFCore\Design\Internal\ICSharpRuntimeAnnotationCodeGenerator.cs:line 117
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpRuntimeModelCodeGenerator.Create(IProperty property, String variableName, Dictionary`2 propertyVariables, CSharpRuntimeAnnotationCodeGeneratorParameters parameters) in C:\github\efcore\src\EFCore.Design\Scaffolding\Internal\CSharpRuntimeModelCodeGenerator.cs:line 861
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpRuntimeModelCodeGenerator.Create(IProperty property, Dictionary`2 propertyVariables, CSharpRuntimeAnnotationCodeGeneratorParameters parameters) in C:\github\efcore\src\EFCore.Design\Scaffolding\Internal\CSharpRuntimeModelCodeGenerator.cs:line 690
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpRuntimeModelCodeGenerator.CreateEntityType(IEntityType entityType, IndentedStringBuilder mainBuilder, IndentedStringBuilder methodBuilder, SortedSet`1 namespaces, String className, Boolean nullable) in C:\github\efcore\src\EFCore.Design\Scaffolding\Internal\CSharpRuntimeModelCodeGenerator.cs:line 540
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpRuntimeModelCodeGenerator.GenerateEntityType(IEntityType entityType, String namespace, String className, Boolean nullable) in C:\github\efcore\src\EFCore.Design\Scaffolding\Internal\CSharpRuntimeModelCodeGenerator.cs:line 462
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpRuntimeModelCodeGenerator.GenerateModel(IModel model, CompiledModelCodeGenerationOptions options) in C:\github\efcore\src\EFCore.Design\Scaffolding\Internal\CSharpRuntimeModelCodeGenerator.cs:line 75
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpRuntimeModelCodeGeneratorTest.Test(DbContext context, CompiledModelCodeGenerationOptions options, Action`1 assertScaffold, Action`1 assertModel, Type additionalDesignTimeServices, Action`1 useContext, String expectedExceptionMessage) in C:\github\efcore\test\EFCore.Design.Tests\Scaffolding\Internal\CSharpRuntimeModelCodeGeneratorTest.cs:line 12338
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpRuntimeModelCodeGeneratorTest.BigModel_with_JSON_columns() in C:\github\efcore\test\EFCore.Design.Tests\Scaffolding\Internal\CSharpRuntimeModelCodeGeneratorTest.cs:line 4439
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
/// </para> | ||
/// </remarks> | ||
/// <typeparam name="TElement">The element type.</typeparam> | ||
public sealed class ListComparer<TElement> : ValueComparer<IEnumerable<TElement>> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this replace the equivalent one in Cosmos?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure there's a compiled model test with a primitive collection
/cc @danmoseley |
812d6c8
to
47800f6
Compare
Part of #25364